package com.ruoyi.web.controller.app.service;

import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.web.exception.base.XException;
import com.ruoyi.sj.domain.RedReceive;
import com.ruoyi.sj.mapper.RedReceiveMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @ClassName AppGoldPackageService
 * @Description TODO
 * @Author tyc@yanyu
 * @Date 2018/12/29 0029 09:16
 **/
@Service
public class AppGoldPackageService {
      @Autowired
      private RedReceiveMapper redReceiveMapper;

    public Object getGoldList(String redId, int type) {
        if (StringUtils.isBlank(redId)){
            throw new XException("用户ID号不能为空");
        }
        //获取收到的所有红包或金包
        RedReceive redReceive = new RedReceive();
        redReceive.setType(type);
        redReceive.setRedId(Long.valueOf(redId));
        return redReceiveMapper.selectRedReceiveByMemberId(redReceive);
    }
}
